<template>
	<tm-button @click="reload">默认</tm-button>
</template>

<script setup lang="ts">
	import { setLanguage } from '@/utils/i18n'
	import { useI18n } from 'vue-i18n'
	import { onLoad } from "@dcloudio/uni-app"

	interface tabbarItem {
		index : number,
		text : string
	}


	const { t } = useI18n()

	const tabbar : tabbarItem[] = [
		{
			index: 0,
			text: t('tabbar.home')
		},
		{
			index: 1,
			text: t('tabbar.logistics')
		},
		{
			index: 2,
			text: t('tabbar.orderPrice')
		},
		{
			index: 3,
			text: t('tabbar.user')
		},
	]

	const reload = () => {
		setLanguage('en')
		uni.reLaunch({
			url:'/pages/tabbar/index'
		})
	}


	onLoad(() => {
		tabbar.forEach((item :tabbarItem)=>{
			uni.setTabBarItem({
			  index: item.index,
			  text: item.text
			})
		})
	})
</script>

<style>
</style>